<?php

namespace app\validate;

use think\Validate;

class WebAdvertisementValidate extends Validate
{
    protected $rule = [
        'title'       => 'require|max:255',
        'image_url'   => 'require|url',
        'click_type'  => 'require|in:1,0',
        'jump_url'    => 'url',
        'sort'        => 'integer',
        'is_display'  => 'in:0,1',
        'app_id'      => 'require|max:32' 
    ];

    protected $message = [
        'title.require'      => '标题不能为空',
        'title.max'          => '标题长度不能超过255个字符',
        'image_url.require'  => '图片URL不能为空',
        'image_url.url'      => '图片URL格式不正确',
        'click_type.require' => '点击类型不能为空',
        'click_type.in'      => '点击类型值无效',
        'jump_url.url'       => '跳转地址格式不正确',
        'sort.integer'       => '排序必须为整数',
        'is_display.in'      => '是否展示值无效',
        'app_id.require'     => '产品唯一标识ID不能为空', 
        'app_id.max'         => '产品唯一标识ID长度不能超过32个字符'
    ];
}